package ch13;
import ch13.Trapezoid;
public class ComparableTrapezoid extends Trapezoid
    implements Comparable<ComparableTrapezoid>{
    public ComparableTrapezoid(double upperBase,double driveDownm,double height,double leftWaist,double rtWaist){
        super(upperBase, driveDownm, height, leftWaist, rtWaist);
    }

    @Override
    public int compareTo(ComparableTrapezoid od) {
        if (getPerimeter()<od.getPerimeter())
        return 1;
        else if (getPerimeter()> od.getPerimeter()) {
            return -1;
        }else {
            return 0;
        }

    }

    public String toString(){
        return " 梯形面积："+ getArea() + "  梯形周长：" + getPerimeter();
    }
}
